module('lgx.decls.enum', package.seeall)

local decl = require'lgx.decl'
local mt = decl.new()
mt.__index = mt

function new(o)
    o = decl.new(o)
    o.tag = decl.ENUM
    o.enumvals = {}
    setmetatable(o,mt)
    return o
end

function mt:addsub(tag, sub)
    if tag == decl.ENUMVAL then
        table.insert(self.enumvals, sub)
    else
        assert(false, string.format('can not add "%s" to enum', tag))
    end
end

